/*
 *  Copyright 2009 David Kuhn <david.s.kuhn at gmail.com>.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  under the License.
 */
package com.google.code.teamtools.gwtrpc;

import java.util.List;

import org.dozer.Mapper;

import com.google.code.teamtools.client.model.EmployeeModel;
import com.google.code.teamtools.domain.impl.Employee;
import com.google.code.teamtools.service.IEmployeeService;

/**
 * Adapter
 * 
 * @author David Kuhn <david.s.kuhn at gmail.com>
 */
public class EmployeeServiceAdapter implements com.google.code.teamtools.client.service.IEmployeeService
{
    private Mapper beanMapper;
    private IEmployeeService employeeService;
    
    /**
     * Injection point for an employee service.
     * 
     * @param service the employee service implementation to inject
     */
    public void setEmployeeService(IEmployeeService service)
    {
        this.employeeService = service;
    }

    public void delete(EmployeeModel employee)
    {
        employeeService.deleteById(employee.getId());
    }

    public EmployeeModel getEmployee(EmployeeModel employee)
    {
        Employee e = employeeService.getEmployeeById(employee.getId());
        return beanMapper.map(e, EmployeeModel.class);
    }

    public EmployeeModel getEmployeeById(Long id)
    {
        Employee e = employeeService.getEmployeeById(id);
        return beanMapper.map(e, EmployeeModel.class);
    }

    public List<EmployeeModel> getEmployees()
    {
        // TODO Auto-generated method stub
        return null;
    }

    public void saveOrUpdate(EmployeeModel employee)
    {
        // TODO Auto-generated method stub
        
    }
}
